package com.feiyu.logistics.controller;

import com.feiyu.logistics.dto.LogisticsDto;
import com.feiyu.logistics.entity.LogisticsInfoEntity;
import com.feiyu.logistics.service.LogisticsOrderService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author: Doate
 * @Date: Created in 2021/4/15 21:35
 * @Description:
 */

@RestController
public class LogisticsFeignController {

    @Resource
    LogisticsOrderService service;

    @PostMapping("/add")
    public Integer addLogisticsOrder(@RequestBody LogisticsInfoEntity param) {

        Integer id = service.addLogisticsOrder(param);

        return id;
    }

    @PostMapping("/feign/searchById")
    public Map<String, Object> searchById(@RequestBody int logisticsId) {

        return service.searchById(logisticsId);
    }

    @PostMapping("/feign/receive")
    public boolean receiveGoods(@RequestBody LogisticsDto dto) {

        service.receiveGoods(dto.getLogisticsId(), dto.getState());

        return true;
    }

}
